(function() {
        var a;
        var f = function(k) {
                if (typeof k === "string") {
                        return document.getElementById(k)
                } else {
                        return k
                }
        };
        function c(k) {
                if (typeof k !== "string") {
                        throw "trim need a string as parameter"
                }
                if (typeof k.trim === "function") {
                        return k.trim()
                } else {
                        return k.replace(/^(\u3000|\s|\t|\u00A0)*|(\u3000|\s|\t|\u00A0)*$/g, "")
                }
        }
        function d(k, n, m) {
                var l = f(k);
                if (l == null) {
                        return false
                }
                n = n || "click";
                if ((typeof m).toLowerCase() != "function") {
                        return
                }
                if (l.attachEvent) {
                        l.attachEvent("on" + n, m)
                } else {
                        if (l.addEventListener) {
                                l.addEventListener(n, m, false)
                        } else {
                                l["on" + n] = m
                        }
                }
                return true
        }
        function g(l, p) {
                var o = c(l).split("&");
                var m = {};
                var q = function(r) {
                        if (p) {
                                return decodeURIComponent(r)
                        } else {
                                return r
                        }
                };
                for (var n = 0, k = o.length; n < k; n++) {
                        if (o[n]) {
                                _hsh = o[n].split("=");
                                _key = _hsh[0];
                                _value = _hsh[1];
                                if (_hsh.length < 2) {
                                        _value = _key;
                                        _key = "$nullName"
                                }
                                if (!m[_key]) {
                                        m[_key] = q(_value)
                                } else {
                                        if ($.core.arr.isArray(m[_key]) != true) {
                                                m[_key] = [m[_key]]
                                        }
                                        m[_key].push(q(_value))
                                }
                        }
                }
                return m
        }
        var i = function() {
                if (window.postMessage) {
                        d(window, "message", j)
                } else {
                        e(window, "name")
                }
        };
        var e = function(k, o) {
                var n = "";
                function l(p) {
                        var q = p.split("^").pop().split("&");
                        return {
                                domain: q[0],
                                data: window.unescape(q[1])
                        }
                }
                function m() {
                        var p = k[o];
                        if (p != n) {
                                n = p;
                                j(l(p))
                        }
                }
                a = setInterval(m, 1000 / 20)
        };
        var j = function(l) {
                l = l || window.event;
                var m = unescape(l.data);
                var k = g(m);
                if (typeof k.goTop != "undefined") {
                        h(k.goTop)
                } else {
                        b(k)
                }
        };
        var b = function(l) {
                if (l) {
                        var k, m = l.force;
                        if (m != null && m == "true") {
                                k = parseInt(l.height, 10)
                        } else {
                                if (parseInt(l.height, 10) < 600) {
                                        k = 600
                                } else {
                                        if (parseInt(l.height, 10) > 5000) {
                                                k = 5000
                                        } else {
                                                k = l.height
                                        }
                                }
                        }
                        f("apps").style.height = k + "px"
                }
        };
        function h(k) {
                if (k !== "page") {
                        f("weibo_top_public").scrollIntoView(true)
                } else {
                        f("apps").scrollIntoView(true)
                }
        }
        i()
})();